package p83;
import java.io.*;
public class Main {
	int year;
	int month;
	int day;
	public Main()
	{
		year=2000;
		month=1;
		day=1;
	}
	public boolean fac(int m){
		if(m%400==0||(m%4==0&&m%100!=0))
		return true;
		else
		return false;
	}
	public int getNumber()
	{
		int b;
		String s="";
		try{
				BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
				s=in.readLine();
			}catch(IOException e){}
			b=Integer.parseInt(s);
			return b;
	}
	public static void main(String[] args){
		Main x=new Main();
		int a,b,c;
		System.out.println("请输入年，月，日：");
		a=x.getNumber();
		while(a<=0||a>2021)
			{
				System.out.println("输入的年份不合法，请重新输入：");
				a=x.getNumber();
			}
		b=x.getNumber();
		while(b<=0||b>12)
			{
				System.out.println("输入的月份不合法，请重新输入：");
				b=x.getNumber();
			}
		c=x.getNumber();
		while(x.fac(a)&&b==2&&(c<0||c>29))
		{
				System.out.println("输入的天不合法，请重新输入：");
				c=x.getNumber();
		}
		while((!x.fac(a))&&b==2&&(c<0||c>28))
		{
				System.out.println("输入的天不合法，请重新输入：");
				c=x.getNumber();
		}
		while(b==1||b==3||b==5||b==7||b==8||b==10||b==12||(c<0||c>31))
		{
				System.out.println("输入的天不合法，请重新输入：");
				c=x.getNumber();
		}
		while(b==4||b==6||b==9||b==11||(c<0||c>30))
		{
				System.out.println("输入的天不合法，请重新输入：");
				c=x.getNumber();
	    }
		x.year=a;
		x.month=b;
		x.day=c;
		System.out.println(x.year+"/"+x.month+"/"+x.day);
	} 
}

